<template>
	<view>
		<view class="uni-container">
			<uni-table ref="table" :loading="loading" border stripe type="selection" emptyText="暂无更多数据" @selection-change="selectionChange">
				<uni-tr>
					<uni-th width="50" align="center">日期</uni-th>
					<uni-th width="50" align="center">姓名</uni-th>
					<uni-th align="center">地址</uni-th>
					<uni-th width="204" align="center">设置</uni-th>
				</uni-tr>
				<uni-tr v-for="(item, index) in dataList" :key="index">
					<uni-td>{{ item.date }}</uni-td>
					<uni-td>
						<view class="name">{{ item.name }}</view>
					</uni-td>
					<uni-td align="center">{{ item.address }}</uni-td>
					<uni-td>
						<view class="uni-group">
							<button class="uni-button" size="mini" type="primary">修改</button>
							<button class="uni-button" size="mini" type="warn">删除</button>
						</view>
					</uni-td>
				</uni-tr>
			</uni-table>
			<view class="uni-pagination-box"><uni-pagination show-icon :page-size="pageSize" :current="pageCurrent" :total="total" @change="change" /></view>
		</view>
	</view>
</template>


<script>
	import config from '@/config'
	import {
		goodslistAndParent,
		removeUpdate
	} from "@/api/system/index"
	const baseUrl = config.baseUrl
	export default {
		data() {
			return {
				name: '',
				text: '',
				searchValue: '',
				tableList: [{
						title: '全部',
						status: '',
						state: 0,
					},
					{
						title: '已完成',
						status: 1,
						state: 1
					},
					{
						title: '未完成',
						status: 0,
						state: 2
					}
				], //table列表
				row: 10,
				tabList: [],
				tableIndex: 0, //当前选择
				dataList: [],
				status:'',
			}
		},
		onLoad(e) {
			this.name = uni.getStorageSync('storage_data').vuex_name
			this.getList()
		},
		methods: {
			goto1(e) {
				uni.navigateTo({
				  url: '/pagesA/mine/productiveTask/addTask/index?info=' + JSON.stringify(e)
				});
			},
			deleteBnt(e) {
				var add = e
				uni.showModal({
					title: '提示',
					content: '确定删除报工吗？',
					success :(res)=> {
						if (res.confirm) {
							removeUpdate(add.id).then(res=>{
								this.$refs.paging.reload()
							})
						} else if (res.cancel) {
							console.log('用户点击取消');
						}
					}
				});
			},
			getList() {
				goodslistAndParent({
					userName:this.name,
				}).then(res => {
					this.dataList = res.rows
					console.log(res, '这是什么')
				})
			}
		}

	}
</script>

<style lang="scss">
	.content {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		padding-left: 20rpx;
		padding-right: 20rpx;

		.table-box {
			width: 750rpx;
			position: sticky;
			top: 0;
			z-index: 2;
			background: #ffffff;
			display: flex;
			justify-content: space-around;

			.table {
				padding: 23rpx 0;
				font-size: 28rpx;
				font-weight: 400;
				color: #666666;
				display: flex;
				flex-direction: column;
				align-items: center;

				.border {
					margin-top: 10rpx;
					width: 32rpx;
					height: 4rpx;
				}
			}

			.tableChange {
				padding: 23rpx 0;
				font-size: 28rpx;
				font-weight: 400;
				color: #333333;
				display: flex;
				flex-direction: column;
				align-items: center;

				.border {
					margin-top: 10rpx;
					width: 32rpx;
					height: 4rpx;
					background: #8295BC;
				}
			}
		}

		.search-box {
			width: 750rpx;
			height: 103rpx;
			background: #FFFFFF;
			z-index: 99;
		}

		.list-box {
			padding-left: 20rpx;
			padding-right: 20rpx;
			margin-top: 20rpx;
			border-radius: 8rpx;
			background: #FFF;

			.top-box {
				display: flex;
				align-items: center;
				padding: 20rpx 0rpx;

				.tiem-box {
					color: #999;
					font-size: 24rpx;
				}

				.status-box {
					margin-left: auto;
					display: flex;
					align-items: center;

					.item-box {
						padding: 4rpx 12rpx;
						width: 96rpx;
						height: 42rpx;
						border-radius: 10rpx;
						background: #F5F7FB;
						color: #8295BC;
						font-size: 24rpx;
					}
				}
			}

			.xian {
				width: 662rpx;
				border-bottom: 1px solid #EAEAEA;
			}

			.title-box {
				padding-top: 20rpx;
				padding-bottom: 20rpx;
				color: #333;
				font-size: 28rpx;
				font-weight: bold;
			}

			.info-box {
				display: flex;
				align-items: center;
				border-radius: 8rpx;
				background: #F5F7FB;
				padding-top: 10rpx;
				padding-bottom: 10rpx;

				.info-item {
					flex: 1;
					display: flex;
					flex-direction: column;
					align-items: center;
					justify-content: center;

					.info-item-title {
						color: #999;
						font-size: 24rpx;
					}

					.info-item-text {
						margin-top: 8rpx;
						color: #333;
						font-size: 28rpx;
						font-weight: bold;
					}
				}
			}

			.text-box {
				padding-top: 20rpx;
				padding-bottom: 20rpx;
				color: #999;
				font-size: 24rpx;
			}

			.bnt-box {
				padding-top: 20rpx;
				padding-bottom: 20rpx;

				.bnt-big-box {
					display: flex;
					justify-content: flex-end;
					align-items: center;

					.bnt {
						margin-right: 20rpx;
						display: flex;
						align-items: center;
						border-radius: 10rpx;
						background: #F5F7FB;
						padding: 15rpx 30rpx 15rpx 30rpx;
						color: #4D8987;
						font-size: 24rpx;
					}
					.bnt1 {
						margin-right: 20rpx;
						display: flex;
						align-items: center;
						border-radius: 10rpx;
						background: #4D8987;
						padding: 15rpx 30rpx 15rpx 30rpx;
						color: #ffffff;
						font-size: 24rpx;
					}
				}
			}
		}
	}
</style>